package com.demo.common.exception;

import com.demo.common.base.BaseExceptionEnum;

/**
 * 业务异常
 *
 * @author admin
 */
public class BizException extends RuntimeException {
    private static final long serialVersionUID = 1947713382118924383L;
    Integer errorCode = 500;

    public BizException(BaseExceptionEnum baseExceptionEnum) {
        super(baseExceptionEnum.getDesc());
        this.errorCode = baseExceptionEnum.getCode();
    }

    public BizException(BaseExceptionEnum baseExceptionEnum, String message) {
        super(message);
        this.errorCode =  baseExceptionEnum.getCode();
    }

    public BizException(BaseExceptionEnum baseExceptionEnum, Throwable t) {
        super(baseExceptionEnum.getDesc(), t);
        this.errorCode = baseExceptionEnum.getCode();
    }

    public BizException(String message) {
        super(message);
    }

    public BizException(String message, Throwable t) {
        super(message, t);
    }

    public BizException(Throwable t) {
        super("业务异常", t);
    }

    public Integer getErrorCode() {
        return this.errorCode;
    }
}
